#Conditional Hooks
$Application: FS2_Open

$On Game Init: [[jd_axmsg-init.lua]]

$State: GS_STATE_GAME_PLAY
$On Gameplay Start:
[
	if not AXMessage.Enabled then
		AXMessage:Init()
	end
]

$On State End:
[
	if AXMessage.Enabled then
		AXMessage:Exit()
	end
]

$On HUD Draw:
[
	if hu.HUDDrawn then
		if AXMessage.Enabled and AXMessage.DrawControl == "self" then
			AXMessage:UpdateString()
			AXMessage:Draw()
			if not hu.HUDDisabledExceptMessages and AXMessage.Backlog and AXMessage.Backlog.Enabled then
				AXMessage:DrawBacklog()
			end
		end
	end
]

$On Message Received:
[

--Hook vars: "Name" (Message name), "Message" (Message Text), "SenderString" (Displayed name), "Builtin" (boolean if its a builtin message), "Sender" (object handle that sent, not always valid!!!!)

	if AXMessage.Enabled and AXMessage.DrawControl == "self" then
		AXMessage:SetupMessage(hv.SenderString, hv.Name, hv.Message)
	end

]

$On HUD Message Received:
[
	--[[hv.Source Types:
	0->Computer (Things like "Warp Drive Broken")
	1->Training (Carries over from the Training Messages)
	2->Hidden (Things like "Cannot fire %s without a lock")
	3->Important (Not actually used)
	4->Failed (Used for objective status in the message log)
	5->Satisfied (Ditto)
	6->Terran Command (Anything from #Command)
	7->Netplayer (Multichat)
	8+->Teams (8 = friendly, 9 = hostile etc etc)
	]]--

	if AXMessage.Enabled and AXMessage.Backlog then
		if ((hv.SourceType == 0) or (hv.SourceType == 2)) then
			AXMessage:AddToBacklog("SYSTEM", hv.Text)
		end
	end

]

$State: GS_STATE_GAME_PAUSED
$On Frame:
[
	if AXMessage.Timer then
		AXMessage.Timer = AXMessage.Timer + ba.getRealFrametime()
	end
]
#End